<?php

namespace App\Http\Services;

use App\Lib\rc;

/**
 * 废弃, 不再使用，使用系统中已有的
 * @deprecated
 */
class CommonFullScreenMsgServices extends CommonServices
{
    /**
     * 消息类库
     *
     * @var mixed
     */
    private $cloudLib;

    /**
     * 房间id
     *
     * @var int
     */
    private $chatRoomId;

    /**
     * 构造函数
     */
    public function __construct()
    {
        parent::__construct();
        $this->cloudLib = new rc();
        $this->chatRoomId = config('rong_cloud.chat_room_id');
    }

    /**
     * 发送飘屏消息
     *
     * @param string $bgImg 背景图
     * @param array $text 消息内容
     * @param string $iconImg icon图片
     * @param string $actionImg
     * @param string $action 点击之后目的地地址
     * @return bool
     */
    public function sendFullScreenMsg(string $bgImg, array $text, string $iconImg = '', string $actionImg = '', string $action = ''): bool
    {
        // write_log(
        //     'CommonFullScreenMsgServices'.(isCli()?'-cli':''),
        //     '[INFO] 发送飘屏消息-已废弃方法-sendFullScreenMsg',
        //     func_get_args()
        // );
        $data = [
            'k' => 80017,
            'bg_img' => $bgImg,
            'icon_img' => $iconImg,
            'action_img' => $actionImg,
            'text_float' => $text,
            'action' => $action,
        ];
        $this->cloudLib->publish_chat_room(11, $this->chatRoomId, 'kk:full_float_screen', $data);
        return true;
    }
}